<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>js中的装饰器</title>
</head>
<!-- 
  装饰器
    1.装饰器与类相关
    2.装饰器就是一种函数，可以在类和类方法之前定义
  
  在类或类的属性方法前面写上，@函数名 就相当于调用了这个函数
 -->

<body>

</body>
<script>
  "use strict";
  const mytest = (target) => {
    // target就是前面的类名
    target.isok = true;
    console.log(`输出内容了吧`);
  };
  @mytest class aade {
    constructor(x, y) {
      this.x = x;
      this.y = y;
    }
  };

</script>

<script>
  "use strict";
  const readonly = (target, name, descriptor) => {

  };
  class preson {
    constructor() { }
    @readonly abc() {
      
    }
    aon
  };
</script>

</html>